﻿@using Smartstore.Web.Models.Cart;

@model ShoppingCartModel.RewardPointsBoxModel

@{
    if (!Model.DisplayRewardPoints)
    {
        return;
    }

    var isExpanded = Model.UseRewardPoints;
}

<div class="cart-action cart-action-rewardpoints">
    <h5 class="cart-action-title" attr-class='(!isExpanded, "collapsed")' data-toggle="collapse" data-target="#cart-action-rewardpoints-body" aria-controls="cart-action-rewardpoints-body" aria-expanded="@isExpanded.ToString().ToLower()">
        @T("ShoppingCart.RewardPoints")
    </h5>

    <div class="cart-action-body collapse" attr-class='(isExpanded, "show")' id="cart-action-rewardpoints-body" aria-expanded="@isExpanded.ToString().ToLower()">
        <div class="reward-points alert alert-info">
            <div class="form-check">
                <input asp-for="UseRewardPoints" type="checkbox" sm-ignore-label="true" sm-switch="false" class="form-check-input"/>                
                <label asp-for="UseRewardPoints" class="form-check-label"> 
                    @Html.Raw(T("Checkout.UseRewardPoints", $"<strong>{Model.RewardPointsBalance}</strong>", $"<strong>{Model.RewardPointsAmount}</strong>"))
                </label>
            </div>
        </div>

        <div class="form-group">
            <button type="submit" name="applyrewardpoints" value="applyrewardpoints" class="btn btn-primary">
                <i class="fa fa-check"></i>
                <span>@T("ShoppingCart.RewardPoints.Button")</span>
            </button>
        </div>
    </div>
</div>